package com.jinghua.treatment.service.impl;

import com.jinghua.treatment.entity.InquiryPic;
import com.jinghua.treatment.mapper.InquiryPicMapper;
import com.jinghua.treatment.service.InquiryPicService;
import com.jinghua.treatment.tools.IDGenerator;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * Created by 王兴光 on 2018/6/11.
 */
@Service
public class InquiryPicServiceImpl implements InquiryPicService {
    @Resource
    private InquiryPicMapper inquiryPicMapper;

    @Override
    public int insert(List<InquiryPic> inquiryPicList, String inquiryId) {
        int result = 0;
        for (InquiryPic pic:inquiryPicList){
            pic.setInquiryId(inquiryId);
            pic.setUploadTime(new Date());
            pic.setUuid(IDGenerator.uuid());
            inquiryPicMapper.insertSelective(pic);
            result = 1 ;
        }
        return result;
    }
}
